Skip to content

Abdurakhmon (Homework)#29

Open
aXayitov wants to merge 3 commits intomasterfrom
111
Open

Abdurakhmon (Homework)#29
aXayitov wants to merge 3 commits intomasterfrom
111

Conversation

@aXayitov
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fayl o'zgarishi kerak emas!

{
internal class Program
{
public delegate bool Predicate1<T>(int t, int max);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Predicate1<T> degani bu T toifasi xozircha noma'lum, kelajakda bu delegatdan foydalanilganda, ma'lum qilinadi foydalanuvchini oz'i. Lekin, bu toifa delegat tomondan umuman ishlatilmayapti, bu degani bu generic toifa mutlaqo keraksiz.

}
Console.WriteLine(min);
}
static void Where(int[] number, Predicate<int> predicate)
Copy link
Copy Markdown
Contributor

@Mirazyzz Mirazyzz Sep 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where metodini qaytaruv toifasi int massivi bo'lishi kerak. number parametirini nomida "s" xarfi qolib ketgan.

Console.WriteLine(i);
}
}
static bool NegativeNumbers(int num)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool qaytaradigan metod va o'zgaruvchanlar odatda nomi savol asosida beriladi. Misol uchun: IsNegative -> Manfiymi? IsPositive -> Musbatmi? IsEven -> Juftmi va xokazo... Bu kodni sifatini oshiradi, sababi metod faqat ikta qiymat qaytaradi, metodni chaqirgan odam birdanigi bu metod nima qaytarishi tushuna oladi.

Comment on lines +65 to +69
if (num < 0)
{
return true;
}
return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug tekshiruvni undan-da osonlashtirsa ham bo'ladi.

Comment on lines +73 to +77
if (num1 < max)
{
return true;
}
return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operator ishlatsa bo'ladi.

Comment on lines +81 to +85
if (number < 0)
{
return false;
}
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tekshiruvni qisqartirsa bo'ladi.

Comment on lines +89 to +93
if (min < number)
{
return true;
}
return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operator yaxshiroq to'gri keladi.

Copy link
Copy Markdown
Contributor

@Mirazyzz Mirazyzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kodni sifati umuman olganda yomon emas, ammo kichik kamchiliklar bilan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants